﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _80X_CG_Frame.Objects
{
    /// <summary>
    /// 载具
    /// </summary>
    public class Tray : INotifyPropertyChanged
    {
        string iD;
        string barcode;
        Product product;
        bool has_cg;
        bool has_piece;
        bool has_nut1;
        bool has_nut2;
        public Tray()
        {
            ID = "";
            Barcode = "";
            有屏蔽片 = false;
            有大螺母 = false;
            有小螺母 = false;
            Product = new Product();
            有CG片 = false;
        }
        public Tray(string id)
        {
            ID = id;
            Barcode = "";
            有屏蔽片 = false;
            有大螺母 = false;
            有小螺母 = false;
            Product = new Product();
            有CG片 = false;
        }
        public string Barcode
        {
            get => barcode; set
            {
                barcode = value;
                NotifyPropertyChanged();
            }
        }
        public Product Product
        {
            get => product; set
            {
                product = value;
                NotifyPropertyChanged();
            }
        }
        public string ID
        {
            get => iD; set
            {
                iD = value;
                NotifyPropertyChanged();
            }
        }
        public bool 有屏蔽片
        {
            get => has_piece;set
            {
                has_piece = value;
                NotifyPropertyChanged();
            }

        }
        public bool 有大螺母
        {
            get => has_nut1; set
            {
                has_nut1 = value;
                NotifyPropertyChanged();
            }
        }
        public bool 有小螺母
        {
            get => has_nut2; set
            {
                has_nut2 = value;
                NotifyPropertyChanged();
            }
        }
        public bool 有CG片
        {
            get => has_cg; set
            {
                has_cg = value;
                NotifyPropertyChanged();
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        // This method is called by the Set accessor of each property.
        // The CallerMemberName attribute that is applied to the optional propertyName
        // parameter causes the property name of the caller to be substituted as an argument.
        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
